#include<unistd.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<errno.h>
#include<time.h>
#include<sys/time.h>

/*
 struct timeval
{
__time_t tv_sec;        // Seconds.
__suseconds_t tv_usec;  //Microseconds.
};
*/

int get_time(char *T_time)
{
        struct          timeval tv;
        struct tm       *p;
        static double   last_time=0;


        gettimeofday(&tv, NULL);
        last_time = tv.tv_sec;
        p = localtime(&tv.tv_sec);

        if (NULL != T_time)
        {
                memset(T_time, 0, sizeof(T_time));
                sprintf(T_time, "%04d-%02d-%02d--%02d:%02d:%02d", p->tm_year+1900,\
                p->tm_mon+1, p->tm_mday+1, p->tm_hour+1, p->tm_min+1, p->tm_sec+1);
        }
        return last_time;
}